package cn.snowheart.iterator.menu;

import java.util.Iterator;
import java.util.List;

/**
 * 服务员
 *
 * @author liuwanxiang
 * @version 2019/07/09
 */
public class Waiter {

    private List<Menu> menus;

    public Waiter(List<Menu> menus) {
        this.menus = menus;
    }

    public void printMenu() {
        for (Menu menu : menus) {
            print(menu);

        }
    }

    private void print(Menu menu) {
        Iterator<MenuItem> iterator = menu.createIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }

}
